/*
 *  GeneratorSingleGroup.cpp
 *  SoundController0002
 *
 *  Created by jiro on 11/07/16.
 *  Copyright 2011 jiro music. All rights reserved.
 *
 */

#include "Theory0039_SingleGroupGenerator.h"

namespace theory0039 {

	SingleGroupGenerator::SingleGroupGenerator( int degree )
		: degree( degree )
	{}

	Chord SingleGroupGenerator::GenerateChord( sc::Note::Id noteId ) const
	{
		Chord chord;
		int count;
		int interval;
		if ( ( 12.0 / degree ) == ( 12 / degree ) )
		{
			count = degree;
			interval = 12 / degree;
		}
		else 
		{
			count = 12;
			interval = 1;
		}
		for ( int i = 0; i < count; i++ )
		{
			chord.AddNoteId( noteId );
			noteId = static_cast< sc::Note::Id >( ( noteId + interval ) % sc::Note::NoteIdCount );
		}

		return chord;

	}

	int SingleGroupGenerator::GetDegree() const
	{
		return degree;
	}
}